package com.team.controller;

import com.team.entity.Section;
import com.team.service.SectionService;
import com.team.vo.Result;
import com.team.vo.SectionVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.ws.Service;
import java.util.Date;

/**
 * @author : 陈灰灰
 * @Date: 2022/10/13/20:23
 * @Description:
 */
@RestController
@RequestMapping("/selection")
public class SelectionController {

    @Autowired
    private SectionService sectionService;

    /**
     * 部分列表
     * @param sectionVo 部分签证官
     * @return {@link Result}
     */
    @RequestMapping("/sectionList")
    public Result sectionList(@RequestBody SectionVo sectionVo){
       return sectionService.selectAllSections(sectionVo);
    }

    /**
     * 更新修改科室
     * @Author:chenhuihui
     * @param section 部分
     * @return {@link Result}
     */
    @RequestMapping("/updateSection")
    public Result update(@RequestBody Section section){
        return sectionService.updateSection(section);
    }

    /**@Author:chenhuihui
     * 添加部分
     * @param section 部分
     * @return {@link Result}
     */
    @RequestMapping("/addSection")
    public Result addSection(@RequestBody Section section){
        return sectionService.addSection(section);
    }

    /**
     * 查询所有部分部门id
     *
     * @param currentPage 当前页面
     * @param pageSize    页面大小
     * @param dept        部门
     * @return {@link Result}
     */
    @RequestMapping("queryAllSectionByDeptId")
    public Result queryAllSectionByDeptId(@RequestParam(defaultValue = "1") int currentPage,@RequestParam(defaultValue = "5") int pageSize, Integer dept){
        return sectionService.selectAllSectionByDeptId(currentPage,pageSize,dept);
    }

    @RequestMapping("/selectAlls")
    public Result selectAll(){
        return sectionService.selectAll();
    }

    /**
     * 更新主键选择性
     * @param section 部分
     * @return {@link Result}
     */
    @RequestMapping("/updateByPrimaryKeySelective")
    public Result updateByPrimaryKeySelective(@RequestBody Section section){
        return sectionService.updateByPrimaryKeySelective(section);
    }

    /**
     * 根据id查询科室信息
     * @param id
     * @return
     */
    @RequestMapping("/selectAllByIds")
    public Result selectAllByIds(int id){
        return sectionService.selectAllByIds(id);
    }
}
